#pragma once

#include "Misc/EngineEditorMacros.h"
#include "Ability/EditorAbilityViewModel.h"
#include "EditorOutputAbilityModel.h"
#include "EditorOutputAbilityViewModel.m.h"

class REditorOutputAbilityModel;
class RFont;

RCLASS()
class REditorOutputAbilityViewModel : public REditorAbilityViewModel
{
    ROBJECT

public:
    void BindModel(TSharedObjectPtr<REditorAbilityModel> InModel) override;
    virtual TSharedObjectPtr<RTexture2D> GetIcon() const override;
    virtual TSharedObjectPtr<RTexture2D> GetHighlightIcon() const override;

protected:
    TWeakObjectPtr<REditorOutputAbilityModel> OutputModel;
    TSharedObjectPtr<RTexture2D> Icon;
    TSharedObjectPtr<RTexture2D> HighlightIcon;

    TSharedObjectPtr<RTexture2D> AutoScrollIcon;
    TSharedObjectPtr<RTexture2D> DisabledAutoScrollIcon;

    TSharedObjectPtr<RFont> Font;
    int64_t FontSize = 16;
public:
    TSharedObjectPtr<RFont> GetFont() const { return Font; }
    int64_t GetFontSize() const { return FontSize; }

    float GetScrollPercent() const;
    void SetScrollPercent(float InPercent);

    float GetWholeHeight() const;
    float GetLineHeight() const;

    TDelegate<void> OnLineNumChanged;
    int64_t GetLineNum() const;
    const CString& GetLine(int64_t InIndex) ;


    void ClearLines();
    TSharedObjectPtr<RTexture2D> ClearAllIcon;

    void ToggleAutoScroll();
    TSharedObjectPtr<RTexture2D> GetAutoScrollIcon() const;
    bool IsAutoScroll() const;

};
